package org.stvd.entities.admin;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import org.stvd.core.annotation.serializer.DateTimeSerializer;
import org.stvd.entities.base.BaseEntity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * @Title: Dictionary
 * @Description:  数据字典-实体类
 * @author houzx
 * @date 2020年2月7日
 */
@Entity
@Table(name = "dictionary")
public class Dictionary extends BaseEntity {

	private static final long serialVersionUID = 8837183273732505590L;

	@Id
	@Column(name= "id", nullable = false)
	private String id = "";
	
	/**
	 * 类型
	 */
	@Column(name= "type", nullable = false)
	private String type = "";
	
	/**
	 * 父级ID
	 */
	@Column(name= "upper_id", nullable = false)
    private String upperId = "-1";
	
	/**
	 * 内容
	 */
	@Column(name= "content", nullable = false)
	@NotEmpty(message="字典内容不能为空")
	@Length(max=50, message="字典内容最大可支持输入50个字符")
	private String content = "";
	
	/**
	 * 编号
	 */
	@Column(name= "serial_no", nullable = false)
	@NotEmpty(message="排序编号不能为空")
	@Length(max=10, message="排序编号最大可输入10个字符")
	private String serialNo = "";

	/**
     * 创建人
     */
    @Column(name="create_user", nullable = false)
    private String createUser = "";
    
    /**
     * 创建时间
     */
    @Column(name="create_time", nullable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date createTime = null;
    
    /**
     * 更新时间
     */
    @Column(name="modify_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date modifyTime = null;
	
    @Transient
    private String oldId = "";
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUpperId() {
        return upperId;
    }

    public void setUpperId(String upperId) {
        this.upperId = upperId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getOldId() {
        return oldId;
    }

    public void setOldId(String oldId) {
        this.oldId = oldId;
    }
}
